package bforce;

import java.io.IOException;
import java.util.List;

import salb1.Salb1GeneticOperations;
import salb1.Salb1Genotype;
import salb1.TimeOfOperations;

import common.BasicAgent;
import common.GeneticHelper;
import common.GeneticOperations;

/**
 * Liczy HVR dla podanego pliku z genotypami.
 */
public class HVCalculator<Genotype> {
    
    public HVCalculator(GeneticOperations<Genotype> go, String genotypeFile, double ref_f0, double ref_f1) throws IOException {
        
        List<BasicAgent<Genotype>> agents = GeneticHelper.readPopulationFromFile(go, genotypeFile);
        System.out.println(GeneticHelper.calculateHiperValume(agents, ref_f0, ref_f1));
    }
    
    public static void main (String[] args) {
        
        //String input = "salb1/dokladne/wynik_6_10_6_genotyp.txt";
        String input = "random.txt";
        String problemPath = "input_6_10_6.txt";
        double ref_f0 = 12.0;   // 8
        double ref_f1 = 30.0;  // 30
        
        GeneticOperations<Salb1Genotype> go;
        try {
            go = new Salb1GeneticOperations(new TimeOfOperations(problemPath));
            new HVCalculator<Salb1Genotype>(go,input,ref_f0,ref_f1);
        } catch (IOException e1) {
            e1.printStackTrace();
        }
        
    }
}
